package com.danger.Model.action;

import android.content.Context;
import android.widget.Toast;

import com.danger.Model.listener.OnCommonListener;
import com.danger.Util.FileCacheService;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by danger on 2016/4/23.
 */
public class SettingModelImpl implements SettingModel {

    private Context context;

    public SettingModelImpl(Context context) {
        this.context = context;
    }

    @Override
    public void recoverySetting(OnCommonListener listener) {
        Map<String, Object> map = new HashMap<>();
        map.put("audio_type", "wav");
        map.put("audio_rate", "16000");
        map.put("audio_subtitle", "srt");
        if (new FileCacheService(context).saveSharePreference("setting", map)) {
            listener.onSuccess("已重置为默认设置");
        } else {
            listener.onError("重置为默认失败");
        }
    }

    @Override
    public void checkUpdate() {

    }
}
